import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { ScenicSpotService } from './scenic-spot.service';
import { CreateScenicSpotDto } from './dto/create-scenic-spot.dto';
import { UpdateScenicSpotDto } from './dto/update-scenic-spot.dto';
import { ApiOperation } from '@nestjs/swagger';
 
@Controller('scenic-spot')
export class ScenicSpotController {
  constructor(private readonly scenicSpotService: ScenicSpotService) {}
  @ApiOperation({ summary: '创建景点' })
  @Post()
  create(@Body() createScenicSpotDto: CreateScenicSpotDto) {
    return this.scenicSpotService.create(createScenicSpotDto);
  }
  
  @ApiOperation({ summary: '查询所有景点' })
  @Get()
  findAll() {
    return this.scenicSpotService.findAll();
  }
 @ApiOperation({ summary: '查询单个景点' })
  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.scenicSpotService.findOne(+id);
  }
  @Patch(':id')
  update(@Param('id') id: string, @Body() updateScenicSpotDto: UpdateScenicSpotDto) {
    return this.scenicSpotService.update(+id, updateScenicSpotDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.scenicSpotService.remove(+id);
  }

  @ApiOperation({summary:'根据城市ID查询景点'})
  @Get('city/:cityId')
  findByCity(@Param('cityId')cityId:number){
    return this.scenicSpotService.findByCity(cityId)
  }

}
